﻿
Imports System.Net.Sockets
Imports osi.root.template
Imports osi.root.connector
Imports osi.root.formation
Imports osi.root.procedure
Imports osi.root.utils

Public Class tcp_connection_responder(Of CREATE_DISPATCHER As __do(Of dispatcher))
    Private Shared ReadOnly dispatcher_ctor As CREATE_DISPATCHER

    Shared Sub New()
        dispatcher_ctor = alloc(Of CREATE_DISPATCHER)()
    End Sub

    Public Class create_tcp_responder
        Inherits __do(Of tcp_responder)

        Protected Overrides Function at() As tcp_responder
            Return New tcp_responder(+dispatcher_ctor)
        End Function
    End Class

    Public Class catch_handler
        Inherits __do(Of tcp_responder, Func(Of Byte(), pointer(Of Byte()), event_comb))

        Public Overrides Function at(ByRef k As tcp_responder) As Func(Of Byte(), pointer(Of Byte()), event_comb)
            assert(Not k Is Nothing)
            Return AddressOf k.handler
        End Function
    End Class
End Class
